package priv.yiyuan.example.design.chain;

/**
 * VIP会员折扣
 *
 * @author YiYuan
 * @data 2025/10/11
 * @apoNote
 */
public class VipMemberDiscountStrategy implements DiscountStrategy {

    @Override
    public double calculateDiscount(Order order) {
        if (order.getMemberLevel() == 1) {
            double discountAmount = order.getOriginalPrice() * 0.05;
            order.addAppliedDiscountInfo("VIP会员折扣(5%)");
            System.out.println(String.format("应用VIP会员折扣: 优惠 %.2f 元。", discountAmount));
            return discountAmount;
        }

        return 0;
    }
}
